using System;

namespace CSharp_1209.PropertyDemo
{
    public class Registration
    {
        Register objRegister = new Register();

        public bool AcceptDetails()
        {
            bool flag = true;

            Console.Write("Enter the member name: ");
            objRegister.MemberName = Console.ReadLine();

            Console.Write("Enter the age of the member: ");
            objRegister.Age = Convert.ToInt32(Console.ReadLine());

            Console.Write("Enter the city: ");
            objRegister.City = Console.ReadLine();

            Console.WriteLine("Select your profession:");
            Console.WriteLine("1.  Student");
            Console.WriteLine("2.  Teacher");
            Console.WriteLine("3.  Retired");
            Console.WriteLine("4.  Others");
            Console.Write("Enter your choice: ");

            int value = Convert.ToInt32(Console.ReadLine());

            switch (value)
            {
                case 1:
                    objRegister.Profession = "Student";
                    objRegister.MembershipFee = 1000;
                    break;
                case 2:
                    objRegister.Profession = "Teacher";
                    objRegister.MembershipFee = 1400;
                    break;
                case 3:
                    objRegister.Profession = "Retired";
                    objRegister.MembershipFee = 1500;
                    break;
                case 4:
                    objRegister.Profession = "Others";
                    objRegister.MembershipFee = 2000;
                    break;
                default:
                    Console.WriteLine("Invalid choice");
                    flag = false;
                    break;
            }
            return flag;
        }

        public void Display()
        {
            Console.WriteLine("Name\t\tAge\tCity\t\tProfession\tMembership Fee");
            Console.WriteLine("----\t\t---\t----\t\t----------\t--------------");
            Console.WriteLine(objRegister.MemberName + "\t" 
                + objRegister.Age + "\t" 
                + objRegister.City + "\t" 
                + objRegister.Profession
                + "\t\t" + objRegister.MembershipFee + " $");
        }

        public static void Test()
        {
            //Creating the object of RegistrationTest class
            Registration objRegistration = new Registration();
            bool test = objRegistration.AcceptDetails();

            //Checking the value of the boolean field
            if (test == false)
                return;

            //Invoking the Display method to display the member details
            objRegistration.Display();
        }
    }
}
